<!DOCTYPE html>
<html>
 <head> 
  <meta charset="UTF-8" /> 
  <title>接口明细</title> 
  <link rel="stylesheet" href="/assets/js/layui/css/layui.css" media="all" /> 
  <link rel="stylesheet" href="/assets/css/global.css" media="all" /> 
  <link rel="stylesheet" href="/assets/js/font-awesome/css/font-awesome.min.css" /> 
 </head> 
 <body> 
  <div class="admin-main" dataload="/apiconfig/details/{id}" onfinishcallback="onDataLoadedCallback"> 
   <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;"> 
    <legend>基本信息</legend> 
   </fieldset> 
   <form class="layui-form"> 
    <div class="layui-form-item"> 
     <label class="layui-form-label">接口名称</label> 
     <div class="layui-input-block"> 
      <input type="text" bindAttr="name" class="layui-input" style="background-color: #E8E8E8" readonly="readonly" /> 
     </div> 
    </div> 
    <div class="layui-form-item"> 
     <label class="layui-form-label">请求方法</label> 
     <div class="layui-input-block"> 
      <input type="text" id="httpType" bindAttr="httpType" class="layui-input" style="background-color: #E8E8E8" readonly="readonly" /> 
     </div> 
    </div> 
    <div class="layui-form-item"> 
     <label class="layui-form-label">请求uri</label> 
     <div class="layui-input-block"> 
      <input type="text" id="uri" bindAttr="uri" class="layui-input" style="background-color: #E8E8E8" readonly="readonly" /> 
     </div> 
    </div> 
    <div class="layui-form-item"> 
     <label class="layui-form-label">关联数据库</label> 
     <div class="layui-input-block"> 
      <input type="text" bindAttr="datasource" class="layui-input" style="background-color: #E8E8E8" readonly="readonly" /> 
     </div> 
    </div> 
   </form> 
   <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;"> 
    <legend>操作集</legend> 
   </fieldset> 
   <table class="layui-table" lay-size="sm" style="margin-left: 20px;width: 98%;"> 
    <thead> 
     <tr> 
      <th width="100">步骤名</th> 
      <th>执行SQL</th> 
      <th width="100">结果属性名</th> 
      <th width="100">期望结果</th> 
      <th width="120">错误提示</th> 
     </tr> 
    </thead> 
    <tbody bindAttr="template:actions_tpl"> 
     <script type="text/html" id="actions_tpl">
     {{# layui.each(d.actions, function(index, item){ }}
     <tr>
       <td>{{ item.comment ? item.comment : ('步骤' + (index+1))}}</td>
       <td style="word-break:break-all;">{{ item.dbOperateSql }}</td>
       <td>{{ item.resultName ? item.resultName : '无'}}</td>
       <td>{{ item.expectResult ? item.expectResultName : '无'}}</td>
       <td>{{ item.unexpectMsg ? item.unexpectMsg : '无'}}</td>
     </tr>
    {{# }); }}
 </script> 
    </tbody> 
   </table> 
   <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;"> 
    <legend>请求参数</legend> 
   </fieldset> 
   <form id="testapiForm" class="layui-form"> 
    <div class="layui-form-item"> 
     <div class="layui-inline" style="width: 550px;"> 
      <table class="layui-table" lay-size="sm" style="width: 100%;"> 
       <thead> 
        <tr> 
         <th width="100">参数名</th> 
         <th width="100">参数类型</th> 
         <th width="100">参数格式</th> 
         <th width="100">是否必填</th> 
         <th width="150">默认值</th> 
        </tr> 
       </thead> 
       <tbody bindAttr="template:parameters_tpl"> 
        <script type="text/html" id="parameters_tpl">
     {{# layui.each(d.parameters, function(index, item){ }}
     <tr>
      <td>{{ item.name }}</td>
      <td>{{ item.dataType ? item.dataType : 'string'}}</td>
      <td>{{ item.paramType }}</td>
      <td><input type="checkbox" lay-skin="switch" lay-text="是|否" {{ item.required ? 'checked' : '' }} disabled /></td>
      <td><input type="text" name="{{ item.name }}" value="{{ item.defaultValue ? item.defaultValue : ''}}" class="layui-input" /> </td>
    </tr>
    {{# }); }}
 </script> 
       </tbody> 
      </table> 
     </div> 
     <div class="layui-inline" style="width: 90px;"> 
      <input type="button" id="test_api_btn" class="layui-btn layui-btn-normal" value="试一试" /> 
     </div> 
    </div> 
   </form> 
   <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;"> 
    <legend>响应实例</legend> 
   </fieldset> 
   <pre class="layui-code" lay-title="JSON" lay-skin="notepad" id="response_previve">
    {
      &quot;code&quot;: 200,
      &quot;msg&quot;: &quot;OK&quot;,
      &quot;data&quot;: {}
    }
      </pre> 
  </div> 
  <div id="configdialog" style="display:none;"> 
   <form id="configForm" class="layui-form" action="" style="padding: 20px;" lay-filter="configForm"></form> 
  </div>  
  <script type="text/javascript" src="/assets/js/layui/layui.js"></script> 
  <script>
  var moduleName = 'smartapi';
	var tables = {};
	layui.config({
		version : "1.0.0",
		base : '/assets/js/modules/'
	}).use('smartapi');
	
	function onDataLoadedCallback(data){
		
	}
</script> 
 </body>
</html>